<template>
  <div>
    <div class="t3-head">
      <h1>
        <img class="t3-logo" :src="schoolLogo.logo_url" />
        <span class="t3-title">{{schoolLogo.school_name}}常规示范班评比公告栏</span>
      </h1>
    </div>
    <div>
      <div class="t3-intr">
        <!-- <StatsCoursesFrequence :d="statsCoursesFrequenceData"/> -->
        <h2 class="t3-tit">{{proclamation.title}}</h2>
        <div class="t3-c" v-html="proclamation.content"></div>
      </div>
      <TbData class="t3-cont" ref="vTbData" periodType="periodType"/>
    </div>
  </div>
</template>

<script>
import ajaxApi from '@/modules/ajax-api'
import TbData from './TbData'
// import StatsCoursesFrequence from './StatsCoursesFrequence'
export default {
  components: {
    TbData
    // StatsCoursesFrequence
  },
  data () {
    return {

      proclamation: {}, // 公告
      schoolLogo: {},

      periodType: 'week'

      // statsCoursesFrequenceData: {} // 听课
    }
  },
  beforeRouteUpdate (to, from, next) {
    if (to.query.reload) {
      this.loadData()
    }
    next()
  },
  created () {
    this.loadData()
  },
  methods: {
    loadData () {
      ajaxApi.getSchoolLogo().then(data => {
        this.schoolLogo = data.data || {}
      })
      this.$nextTick(() => {
        this.$refs.vTbData.loadData(this.$route.query.periodType === 'appraise_noticeboard' ? 'week' : 'month')
      })
      // 公告
      ajaxApi.proclamation().then(data => {
        if (data) {
          this.proclamation = data.proclamations[0] || {}
        }
      })
      // 听课
      // ajaxApi.statsCoursesFrequenceOfACampus().then(data => {
      //   this.statsCoursesFrequenceData = data || {}
      // })
    }
  }
}
</script>

<style scoped>
.t3-head {
  background-color: #2fcc9a;
  height: 50px;
  color: #fff;
  text-align: center;
  font-size: 16px;
  line-height: 3;
}
.t3-logo {
  max-height: 30px;
  vertical-align: middle;
}
.t3-title {
  vertical-align: middle;
  font-weight: bold;
}
.t3-cont {
  /* margin-right: 200px; */
  position: absolute;
  top: 50px;
  left: 0;
  right: 220px;
  bottom: 0;
}

.t3-intr {
  float: right;
  width: 220px;
  font-size: 12px;
  color: #c88849;
  line-height: 24px;
  /* padding: 0 10px 0 0; */
  box-sizing: border-box;
}
.t3-tit {
  font-size: 14px;
  text-align: center;
  padding: 20px 0 6px;
}
.t3-c {
  padding: 0 6px;
}
</style>
